package com.example.mumu.passwordbook.domain;

public enum TypeEnum {

    social("社交"),
    financial("金融"),
    entertainment("娱乐"),
    study("学习"),
    life("生活"),
    other("其他");

    TypeEnum(String text) {
        this.text = text;
    }

    private String text;

    public String getText() {
        return text;
    }

    /**
     * 通过text的值来获取枚举值
     */
    public static TypeEnum textOf(String text){
        switch(text){
            case "社交":
                return social;
            case "金融":
                return financial;
            case "娱乐":
                return entertainment;
            case "学习":
                return study;
            case "生活":
                return life;
            case "其他":
                return other;
        }
        return other;
    }
}
